package com.youngfey.database

import groovy.sql.Sql
import groovy.transform.*
import groovy.util.logging.*
import oracle.jdbc.pool.OracleDataSource

import javax.sql.DataSource
import java.sql.Connection

/**
 * Oracle连接工具类
 * @author Young,Fey <fey.young@gmail.com>
 * @version 0.1.d
 * Created at 2013-04-24 11:30
 */

@Log
@Canonical
class Oracle extends Database {
    private DataSource getDataSource() {
        if(dataSource == null) {
            dataSource = new OracleDataSource()
            dataSource.URL = "jdbc:oracle:thin:@$host:$port:$sid"
            dataSource.user = user
            dataSource.password = password
        }
        dataSource
    }

    private final String host, port, user, password, sid
}
